<template>
  <div>
    <h4>Vuex获取最新count为:{{ $store.state.count }}</h4>
    <h3>{{$store.getters.showNum}}</h3>
    <el-button type="success" size="small" icon="el-icon-refresh-left" @click="handleReset">重置count</el-button>
    <el-divider/>
    <my-add/>
    <my-sub/>
  </div>
</template>

<script>
import {mapMutations} from 'vuex'
import add from './Addition'
import sub from './Subtraction'

export default {
  name: "index",
  components: {
    'my-add': add,
    'my-sub': sub,
  },
  methods: {
    ...mapMutations(['resetCount']),
    handleReset() {
      this.resetCount()
    }
  }
}
</script>

<style scoped>

.el-button {
  margin: 5px;
}
</style>
